﻿using Accouting804.ViewModels.AccountViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace Accouting804.Views
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class FilterAndSorterPage : ContentPage
    {

        FilterAndSorterViewModel viewModel;

        public FilterAndSorterPage()
        {
            InitializeComponent();
            BindingContext = viewModel = new FilterAndSorterViewModel();
        }

        private void DatePicker_DateSelected(object sender, DateChangedEventArgs e)
        {
            RefreshSpan();
        }

        private void DatePicker_DateSelected_1(object sender, DateChangedEventArgs e)
        {
            RefreshSpan();
        }

        protected void RefreshSpan()
        {
            timespan_txt.Text = viewModel.DateSpan.ToString();


        }

        private void confirm_btn_Clicked(object sender, EventArgs e)
        {
            if (Confirmed != null) Confirmed.Invoke(viewModel);

        }

        public event FilterAndSorterPageConfirmed Confirmed;


    }
    public delegate void FilterAndSorterPageConfirmed(FilterAndSorterViewModel model);
}